import 'package:flutter/material.dart';
import 'package:xbxxz_assistant/data/land_map_profit_data.dart';

class LandMapProfitPage extends StatefulWidget {
  @override
  _LandMapProfitPageState createState() => _LandMapProfitPageState();
}

class _LandMapProfitPageState extends State<LandMapProfitPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("地图收益(地上)"),
      ),
      body: Container(
        constraints: BoxConstraints.expand(),
        color: Colors.brown,
        child: Padding(
          padding: const EdgeInsets.all(8.0),
          child: SingleChildScrollView(
            scrollDirection: Axis.horizontal,
            child: Column(
              children: <Widget>[
                Card(
                  color: Color.fromRGBO(220, 200, 160, 1.0),
                  elevation: 10.0,
                  shape: const RoundedRectangleBorder(
                      borderRadius:
                          BorderRadius.all(Radius.circular(14.0))), //设置圆角
                  child: Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: _buildTable(),
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }

  Widget _buildTable() {
    return Table(
      columnWidths: {
        0: IntrinsicColumnWidth(),
        1: IntrinsicColumnWidth(),
        2: IntrinsicColumnWidth(),
        3: IntrinsicColumnWidth(),
        4: IntrinsicColumnWidth(),
        5: IntrinsicColumnWidth(),
        6: IntrinsicColumnWidth(),
        7: IntrinsicColumnWidth(),
        8: IntrinsicColumnWidth(),
      },
      border: TableBorder.symmetric(
          inside: BorderSide(
              color: Colors.black12, width: 1.0, style: BorderStyle.solid)),
      children: [
        TableRow(
          children: [
            TableCell(
              child: Center(child: Text("挂机300轮")),
            ),
            TableCell(
              child: Center(child: Text("地肺山")),
            ),
            TableCell(
              child: Center(child: Text("盖竹山")),
            ),
            TableCell(
              child: Center(child: Text("南田山")),
            ),
            TableCell(
              child: Center(child: Text("玉溜山")),
            ),
            TableCell(
              child: Center(child: Text("清屿山")),
            ),
            TableCell(
              child: Center(child: Text("郁木洞")),
            ),
            TableCell(
              child: Center(child: Text("丹霞洞")),
            ),
            TableCell(
              child: Center(child: Text("君山")),
            ),
          ],
        ),
        for (var i = 0; i < landMapProfitData.length; i++)
          TableRow(children: [
            for (var j = 0; j < landMapProfitData[i].length; j++)
              TableCell(
                child: Center(child: Text(landMapProfitData[i][j].toString())),
              ),
          ]),
      ],
    );
  }
}
